home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / dbase / do1beta.zip / PRIVATE.DO < prev    next >
Text File  |  1991-07-23  |  498b  |  23 lines

  1. /*
  2.     demo of a private method for a class
  3.     private methods are only callable from within a method for a class
  4. */
  5. inherit(Nil,Temp,[]);
  6.  
  7. private Temp::testPrivate(self)
  8. {
  9.     ? "within testPrivate";
  10. }
  11.  
  12. method Temp::test(self)
  13. {
  14.     ? "enter Temp::test";
  15.     testPrivate(self);
  16.     ? "exit Temp::test";
  17. }
  18.  
  19. v = new(Temp);
  20. test(v); % this will work, Temp::testPrivate will be called by Temp::test
  21. ? "the next statement will cause an error !...\n";
  22. testPrivate(v); % this will cause an error !
  23.